:root {
    --color-background: #ffffff;
    --color-primary: #f6f8fa;
    --color-hover: #d0d7de52;
    --color-main: #2da44e;
    --color-minor: #2da55a36;
    --color-border: #d0d7de;
    --color-text: #24292f;
    --color-link: #0969da;
    --color-filter: 90deg;
}

@background: var(--color-background);
@primary: var(--color-primary);
@hover: var(--color-hover);
@main: var(--color-main);
@minor: var(--color-minor);
@border: var(--color-border);
@text: var(--color-text);
@link: var(--color-link);
@filter: var(--color-filter);

.radius(@radius: 6px) {
    border-radius: @radius;
}

.border() {
    border: 1px solid @border;
}

.buttons() {
    .radius();
    .border();
    background-color: @primary;
}

/*重置项*/
::selection {
    background: @hover !important;
    color: @text !important;
}

a[href] {
    color: @text;
}

a[href]:hover {
    color: @link;
}

.ui.form input:focus {
    -webkit-box-shadow: none;
    box-shadow: none;
}

/*导航栏*/

body:not(.ide-body) {
    // 除Web IDE外均留出导航栏位置栏
    padding: 62px 0 0 0 !important;
}

body#home-index {
    header#git-header-nav.nav-hanging {
        backdrop-filter: blur(15px);
        background-color: transparent !important;
    }
    header#git-header-nav:not(.nav-hanging) {
        background-color: #f7f7f7 !important;
    }
}

body#explores-index {
    header#git-header-nav.navbar-immersive {
        background-color: #000000 !important;
    }
}

.nav-padding() {
    padding: 8px 0;
}

#git-header-nav.noborder {
    background-color: @text !important;
    min-width: 475px;
    height: 62px !important;
    > div {
        width: 100% !important;
        > div.ui {
            .nav-padding();
        }
    }
}

.nav-bold () {
    color: #ffffff !important;
    font-weight: 600 !important;
}

#git-nav-user-bar {
    // 导航栏右侧用户栏
    .nav-padding();
    > #notice-dropdown > a > i {
        .nav-bold();
    }
    > #git-nav-create > i {
        .nav-bold();
    }
}

/*消除部分元素*/

.erase() {
    width: 0;
    height: 0;
    padding: 0;
    border: 0;
    margin: 0;
    display: none !important;
}

#gitee-go {
    .erase();
}

#git-header-nav > div > div > a.item.margin-0.ml-1 {
    .erase();
}

#git-header-nav > div > div > a > img {
    .erase();
}

#git-header-nav > div > div > a > sup {
    .erase();
}

div.gitee-stars-main-widget.pendan-widget {
    .erase();
}

#feature-update-notice {
    .erase();
}

#rc-users__container
    > div.site-content
    > div.container.rc-users__container.ui
    > div
    > div.four.wide.column.recommend-container
    > div.new_entry.mb-1 {
    .erase();
}

/*dashboard*/

#event-timeline-panel .event-timeline > .content .date-point {
    background-color: @main !important;
}

#rc-users__container
    > div.site-content
    > div.container.rc-users__container.ui
    > div
    > div.four.wide.column.dashboard-sidebar
    > div.user-dashboard-sidebar
    > div:nth-child(3)
    > div
    > div.ui.secondary.menu.git-dashboard-project-menu
    > a.active.item {
    color: @text;
    font-weight: bold;
}

/*个人主页*/

// 活跃墙
.box-radius() {
    border-radius: 25%;
}

div.less {
    .box-radius();
    background-color: #ebedf0 !important;
}

div.little {
    .box-radius();
    background-color: #9be9a8 !important;
}

div.some {
    .box-radius();
    background-color: #40c463 !important;
}

div.many {
    .box-radius();
    background-color: #30a14e !important;
}

div.much {
    .box-radius();
    background-color: #216e39 !important;
}

/*仓库*/

// 仓库头部
body > div.site-content > div.git-project-header {
    background-color: @primary;
    > div.ui.container {
        width: 100%;
        padding: 4px 32px 0 32px;
        // GVP分类
        > div.git-project-categories {
            margin-bottom: -6px;
            opacity: 60%;
            > a:nth-child(1) {
                color: @text;
            }
            > a:nth-child(3) {
                color: @text;
            }
            > a:nth-child(5) {
                color: @text;
            }
        }
        > div.git-project-header-details {
            padding: 0;
            > div.git-project-header-container {
                // 作者名/仓库名
                > .git-project-title {
                    > a.author {
                        font-weight: normal !important;
                    }
                    > a.repository {
                        font-weight: bold !important;
                    }
                }
                // Watch Star Fork
                > .git-project-header-actions {
                    > .watch-container {
                        .radius();
                    }
                    > .star-container {
                        .radius();
                    }
                    > .fork-container {
                        .radius();
                    }
                }
            }
        }
    }
    // 标签
    > div.git-project-nav {
        > div.ui.container {
            width: 100%;
            margin: 0;
            padding: 0 32px;
            > div {
                display: inline-flex !important;
                margin: 0;
                // a 标签
                > a {
                    color: @text !important;
                    margin: 0 20px 0 0 !important;
                }
                // div 标签
                > div {
                    color: @text !important;
                    margin: 0 20px 0 0 !important;
                }
                // 选中标签加粗
                > a.item.active {
                    color: @text !important;
                    font-weight: bolder;
                    //  遗留Issue or Pull Requests数
                    > span {
                        filter: grayscale(100%);
                    }
                }
            }
        }
    }
}

//仓库中部

// 控制按钮
* {
    // 分支
    #git-project-branch {
        .buttons();
    }
    // + Pull Request + Issue
    #git-project-root-actions > div > div:nth-child(1) {
        background-color: @primary;
        > a.ui.gradient.button.repo-action.left.attached {
            border-radius: 6px 0 0 6px;
        }
        > a.ui.gradient.button.repo-action.right.attached {
            border-radius: 0 6px 6px 0;
        }
    }
    // 文件
    #git-project-file {
        .buttons();
    }
    // Web IDE
    a.webide {
        .buttons() !important;
    }
    // Download or Clone
    #btn-dl-or-clone {
        .buttons();
        background-color: @main;
    }
}

// 文件列表
#tree-content-holder > div.ui.flat.nopadding.segment.tree-content {
    .radius();
    .border();
    // 信息栏
    > #git-project-info {
        border-radius: 6px 6px 0 0;
        padding: 13px;
        background-color: @primary !important;
        > div.recent-commit {
            > a {
                // 头像
                > img {
                    width: 24px !important;
                    height: 24px !important;
                    margin: -6px 10px 0 0 !important;
                }
                // 昵称
                > span {
                    font-weight: 600;
                    font-size: 14px;
                }
            }
            // 最后提交名
            > span:nth-child(2) > a {
                color: @text;
            }
            // 最后提交号
            > span:nth-child(3) {
                color: @text;
            }
            // 最后提交时间
            > span.timeago {
                color: @text;
            }
        }
        // 总提交
        > div.all-commits > a {
            color: @text;
        }
    }
    //文件树
    > #tree-slider {
        // 文件项
        > div.row.tree-item {
            border-top: 1px solid var(--color-border);
            margin-top: -1px;
            // 文件名
            > div.tree-item-file-name > a {
                margin-left: 10px;
            }
            // 最后提交名
            > div.nine.wide.column.tree_author > div.commit-details > a {
                color: @text;
            }
            // 最后提交时间
            > div.tree_time_ago > span {
                color: @text;
            }
        }
        > div.row.tree-item:hover {
            background-color: @hover;
            transition: all 100ms;
        }
        > div.row.tree-item:nth-child(2) {
            border-top: 0;
            margin-top: 0;
        }
    }
}

// README
#git-readme > div.ui.flat.nopadding.segment.file_holder {
    .border();
    .radius();
    > .file_title {
        border-color: @border;
        border-radius: 6px 6px 0 0;
        padding: 10px 13px 8px 13px;
        color: @text;
        background-color: @background;
        > span.file_name {
            margin-left: 12px;
        }
    }
    > .file_catalog {
        border-color: @border;
    }
    > .file_content.markdown-body {
        border-color: @border;
    }
}

// README 边栏
* {
    li.catalog-li.active::marker {
        color: @link !important;
    }

    li.catalog-li.active > a.anchor {
        color: @link !important;
    }
}

// 侧边信息栏

// 标签
#project-wrapper
    > div.four.wide.column
    > div
    > div.side-item.intro
    > div:nth-child(2)
    > div
    > div.d-flex.d-flex-between.dropdown.item.js-project-label_show.label-list-line-feed.project-label-list.ui
    > div.mixed-label
    > a
    > div:hover {
    background-color: @main !important;
}

// Gitee指数

#metrics-radar {
    > div.wrap {
        filter: hue-rotate(@filter);
        > div.total-score {
            border-radius: 12px;
        }
    }
}

/*Issue页*/

// 仓库中部

.dropdown-button() {
    border-radius: 6px 0 0 6px;
    .border();
    background: @primary !important; //不要使用background-color,
}

.search-input () {
    .border();
    border-radius: 0 6px 6px 0;
    margin-left: -1px;
    background-color: @primary !important;
}

.dropdown-bar(@radius) {
    .buttons();
    border-radius: @radius;
    overflow: initial;
    max-height: max-content;
    height: auto !important;
}

#git-issues-search {
    > div.search-input-group {
        // 下拉选择
        > div.issue-search-dropdown {
            .dropdown-button();
            > div {
                .dropdown-bar(0 0 6px 6px);
            }
            > div.default.text {
                border: 0;
            }
        }
        > div.issue-search-dropdown.upward {
            > div {
                .dropdown-bar(6px 6px 0 0);
            }
        }
        // 搜索框
        > input.issue-search-input {
            .search-input();
        }
    }
    > div > a.clear-search-input-wrapper {
        right: -150px;
    }
}

.git-issues-tab {
    > div {
        .buttons() !important;
    }
    > div:nth-last-child(1) {
        background-color: @main !important;
        > a#new_issue_link {
            background-color: @main !important;
            box-shadow: none !important;
        }
        > a#new_issue_link.ui.small.button.disabled,
        a#new_issue_link[title="添加附件"] {
            color: #ffffff !important;
            width: 100px;
        }
    }
    > a {
        .buttons() !important;
    }
}

.no-shadow() {
    -webkit-box-shadow: inset 0 0 0 0, inset 0 0 0 0;
    box-shadow: inset 0 0 0 0, inset 0 0 0 0;
}
.filters-bar() {
    .no-shadow();
    background-color: @background;
    > a,
    div {
        color: @text;
    }
}

form#git-issues-filters {
    .filters-bar();
}

.git-panel() {
    .buttons();
    margin-top: 24px;
    padding: 14px;
    > img {
        margin-top: 24px;
        filter: hue-rotate(@filter) !important;
    }
    > p {
        margin-bottom: 16px !important;
        > span {
            color: @text !important;
        }
        > a {
            color: @link;
        }
    }
}

div#git-issues {
    > div {
        .no-shadow();
        > div.issue-info > div.issue-desc.other-info-row.d-align-center > a {
            color: @text;
            opacity: 75%;
        }
    }
    > div {
        .git-panel();
    }
}

/*Pull Request页*/

// 仓库中部

#git-pull-requests-search {
    > div.search-input-group {
        // 下拉选择
        > div.dropdown {
            .dropdown-button();
            > div {
                .dropdown-bar(0 0 6px 6px);
            }
            > div.default.text {
                border: 0;
            }
        }
        > div.dropdown.upward {
            > div {
                .dropdown-bar(6px 6px 0 0);
            }
        }
        // 搜索框（它甚至没改）
        > input.issue-search-input {
            .search-input();
        }
    }
    > div > a.clear-search-input-wrapper {
        right: -150px;
    }
}

div.right-side {
    > a.ui.basic.button {
        .buttons();
    }
    > a:nth-last-child(1) {
        .buttons();
        border: 0;
        background-color: @main !important;
    }
}

form#git-pull-requests-filters {
    .filters-bar();
}

div.git-pull-requests-panel > div.panel-list {
    > div {
        .no-shadow();
    }
    > div {
        .git-panel();
    }
}

/*统计页*/

body > div.site-content > div.ui.container {
    > #project-item-menu {
        // 不同页位置不一致，有待改进
        > div > a {
            color: var(--color-text) !important;
        }
        > div.active.item > a {
            font-weight: 600;
        }
    }
    // 仓库数据统计
    > div.project-stats-page {
        > div.ui.segment.grid.page.page-content {
            > div.eight.wide.column:nth-child(1) {
                > div {
                    .buttons();
                    padding: 32px 0 32px 32px;
                    display: block;
                    > div#activity-chart > svg > path {
                        fill: @link;
                    }
                }
            }
            > div#contributors {
                > div.ui.small.header {
                    .erase();
                }
                > div.ui.list {
                    margin: 0;
                    padding: 0 0 0 32px;
                    > div {
                        .buttons();
                        padding: 8px 16px;
                        margin: 0 0 8px 0px;
                    }
                }
            }
        }
    }
}

/*仓库底部*/
#git-footer-main {
    background-color: @primary !important;
}
